/**
 * Definition for a Node.
 * type Node struct {
 *     Val int
 *     Children []*Node
 * }
 */
// 递归法
func maxDepth(root *Node) int {
    if root == nil {
        return 0
    }
    depth := 0
    for i:=0; i<len(root.Children); i++ {
        depth = max(depth, maxDepth(root.Children[i]))
    }
    return depth+1
}

func max(nums ...int) int {
    max := int(math.Inf(-1)) // 负无穷
    for _, v := range nums {
        if v > max {
            max = v
        }
    }
    return max
}